package com.briup.day24;

import java.io.*;

public class Test_Copy {
    public static void main(String[] args) throws Exception {
        //指定读取GBK 指定写入UTF-8
        /*就是将字节转换字符   然后用GBK编码的形式转换   然后就转成字符了，然后我读取出来的是字符，写入的时候， 把字符转换成字节，按照UTF-8编码来写入*/
        InputStreamReader isr = new InputStreamReader(new FileInputStream("01-Basic/src/dir/GBK.txt"),"GBK");
        BufferedReader br = new BufferedReader(isr);
        OutputStreamWriter os =new OutputStreamWriter(new FileOutputStream("01-Basic/src/dir/UTF-8.txt"),"UTF-8");
        BufferedWriter bw = new BufferedWriter(os);
        String line;
        while((line=br.readLine())!=null){
            bw.write(line);
            if(br.ready()){
                bw.newLine();
            }
        }
        br.close();
        bw.close();
    }
}
